package com.news.service.impl;


import com.news.dao.CommentsDao;
import com.news.dao.impl.CommentsDaoImpl;
import com.news.pojo.Comments;
import com.news.service.CommentsService;

import java.util.List;

public class CommentsServiceImpl implements CommentsService {
    private CommentsDao commentsDao =new CommentsDaoImpl();
    /**
     * 新增评论
     *
     * @param comments
     * @return
     */
    @Override
    public boolean addComments(Comments comments) {
        return commentsDao.addComments(comments) == 1?true:false;
    }

    /**
     * 查询所有评论
     *
     * @return
     */
    @Override
    public List<Comments> getAll() {
        return commentsDao.getAll();
    }

    /**
     * 通过新闻id查询评论
     *
     * @param nid@return
     */
    @Override
    public List<Comments> getAllByNid(int nid) {
        return commentsDao.getAllByNid(nid);
    }
}
